package observerTest;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTextField;

public class ObserverTestDemo {

	private JFrame myFrame;
	private JTextField test1;
	private JButton button1;	
	
	public ObserverTestDemo(){
		
		myFrame = new JFrame();
		
		myFrame.setLayout(new FlowLayout());
		myFrame.setTitle("Test");
		myFrame.setSize(300, 200);
		myFrame.setLocation(350, 300);
		myFrame.setBackground(Color.blue);		
		
		test1 = new JTextField(Main.getTest().getText());
		test1.setPreferredSize(new Dimension(50, 20));
		myFrame.add(test1);
		
		ButtonListener listener = new ButtonListener();
		button1 = new JButton();
		button1.setPreferredSize(new Dimension(30, 15));
		button1.addActionListener(listener);
		myFrame.add(button1);
		
		myFrame.setVisible(true);
		
	}

	public JTextField getTest1() {
		return test1;
	}

	public void setTest1(JTextField test1) {
		this.test1 = test1;
	}
}
